import { createStore } from 'vuex'

const state = {
  token: localStorage.token ? localStorage.getItem('token') : null
}

const mutations = {
  getCurrentToken(state) {
    state.token = localStorage.token ? localStorage.getItem('token') : null
  }
}

const actions = {
  getCurrentToken: ({ commit }) => commit('getCurrentToken')
}

export default createStore({
  state,
  mutations,
  actions
})
